//
//  HNSH_GroupChatInfoChatFooterView.m
//  HNSH_SingleProject
//
//  Created by 李宇廷 on 2023/2/17.
//

#import "HNSH_GroupChatInfoChatFooterView.h"

@interface HNSH_GroupChatInfoChatFooterView ()
/** */
@property (nonatomic, strong)UIButton * clearBtn;
/** */
@property (nonatomic, strong)UIView * segView;
/** */
@property (nonatomic, strong)UIButton * deleteBtn;
@end

@implementation HNSH_GroupChatInfoChatFooterView

//MARK: Cycle Methods
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor appBGColor];
        [self addAllViews];
        [self addAllLayout];
    }
    return self;
}

//MARK: Myself Methods
- (void)addAllViews{
//    [self addSubview:self.clearBtn];
//    [self addSubview:self.segView];
    [self addSubview:self.deleteBtn];
}

- (void)addAllLayout{
    [self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(self);
        make.top.mas_equalTo(10);
        make.height.mas_equalTo(50);
    }];
//    [self.segView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.right.mas_equalTo(self);
//        make.top.mas_equalTo(self.clearBtn.mas_bottom);
//        make.height.mas_equalTo(0.5);
//    }];
//    [self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.right.mas_equalTo(self);
//        make.top.mas_equalTo(self.segView.mas_bottom);
//        make.height.mas_equalTo(50);
//    }];
}

- (void)clearBtnAction{
    if (self.clearBlock) {
        self.clearBlock();
    }
}

- (void)deleteBtnAction{
    if (self.deleteBlock) {
        self.deleteBlock();
    }
}

//MARK: Getter Methods
- (UIButton *)clearBtn{
    if (!_clearBtn) {
        _clearBtn = [UIButton new];
        _clearBtn.titleLabel.font = [UIFont systemFontOfSize:15];
        [_clearBtn setTitle:@"清空聊天记录" forState:UIControlStateNormal];
        [_clearBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        _clearBtn.backgroundColor = [UIColor appWhiteLabelColor];
        [_clearBtn addTarget:self action:@selector(clearBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _clearBtn;
}

- (UIView *)segView{
    if (!_segView) {
        _segView = [UIView new];
        _segView.backgroundColor = [UIColor colorWithHexString:@"#EDEDED"];
    }
    return _segView;
}

- (UIButton *)deleteBtn{
    if (!_deleteBtn) {
        _deleteBtn = [UIButton new];
        _deleteBtn.titleLabel.font = [UIFont systemFontOfSize:15];
        [_deleteBtn setTitle:@"退出群聊" forState:UIControlStateNormal];
        [_deleteBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        _deleteBtn.backgroundColor = [UIColor appWhiteLabelColor];
        [_deleteBtn addTarget:self action:@selector(deleteBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _deleteBtn;
}
@end
